﻿/*------------------------------------------------
 * 更改日期：2011-12-24
 * 更改人：刘兵
 * 更改内容：增加Rename方法
 * 
 * 
 * ----------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Janus.Cores.Files
{
    /// <summary>
    /// 文件管理接口
    /// </summary>
    public interface IFileHandler
    {
        /// <summary>
        /// 保存文件的路径
        /// </summary>
       string ShortPath { get; set; }

        /// <summary>
        /// 保存文件的路径包含文件名
        /// </summary>
        string FullPath { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="file">文件名称</param>
        /// <param name="rename">是否重命名</param>
        /// <param name="folder">目标文件夹名称</param>
        /// <returns></returns>
        string SaveFile(string file, string folder, bool rename);

        /// <summary>
        /// 将一个文件流存储到系统中
        /// </summary>
        /// <param name="fileName">文件名称</param>
        /// <param name="inputStream">文件流</param>
        /// <param name="rename">是否重新命名</param>
        /// <param name="folder"></param>
        /// <returns></returns>
        string SaveFile(string fileName, string folder, Stream inputStream, bool rename);

        /// <summary>
        /// 移除一个文件
        /// </summary>
        /// <param name="name">文件名称</param>
        /// <returns></returns>
        bool Remove(string name);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        Stream OpenFile(string name);

        /// <summary>
        /// 找开文件
        /// </summary>
        /// <param name="name">文件名</param>
        /// <param name="mode"></param>
        /// <returns></returns>
        Stream OpenFile(string name, FileMode mode);


        /// <summary>
        /// 获取文件信息
        /// </summary>
        /// <param name="name">文件名称</param>
        /// <returns>文件信息</returns>
        FileInfomation GetFileInformation(string name);

        /// <summary>
        /// 给文件重新命名
        /// </summary>
        /// <param name="oldFileName">旧的文件名</param>
        /// <param name="newFileName">新的文件名</param>
        /// <returns>成功返回true,否则返回false</returns>
        bool Rename(string oldFileName, string newFileName);


    }
}
